<?php

namespace Frieza\Modules\Position\Actions;

use Encore\Admin\Actions\RowAction;
use Illuminate\Http\Request;

class ManageRecord extends RowAction
{
    public $name = '管理记录';

    public function handle($uid,Request $request)
    {
        // 获取到表单中的`type`值
        $request->get('type');

        // 获取表单中的`reason`值
        $request->get('reason');

        // 你的举报逻辑...

        return $this->response()->success('举报已提交')->refresh();

    }

    public function retrieveModel(Request $request)
    {
        if (!$key = $request->get('_key')) {
            return false;
        }

        return $key;
    }

    public function form()
    {
        $type = [
            1 => '广告',
            2 => '违法',
            3 => '钓鱼',
        ];

        $this->checkbox('type', '类型')->options($type);
        $this->textarea('reason', '原因')->rules('required');
    }
}
